<cfquery name="getemail" datasource="exp" >
select * from user where email=<cfqueryparam cfsqltype="cf_sql_varchar" value="#username#">
</cfquery>

<cfif #getemail.RecordCount# gt 0>

<cfmail type="html" 
from="0707249r@student.gla.ac.uk" 
subject="Forgotten Password" 
to="#getemail.email#"
server="mr1.dcs.gla.ac.uk"
spoolenable="no">
Your Ecada password is:<br>
#getemail.password#<br>
thanks
</cfmail> 

<cfset session.message = "Your password has been emailed to you">

<cfelse >
<cfset session.message = "There are no accounts with this email address">
</cfif>
<cflocation url="/ecada/index.cfm">
